Skip to content

Fix airbyte 2x legacy events#148

Closed
Smidge wants to merge 3 commits intoplanetscale:mainfrom
anam-org:fix/airbyte-2x-stream-status
Closed

Fix airbyte 2x legacy events#148
Smidge wants to merge 3 commits intoplanetscale:mainfrom
anam-org:fix/airbyte-2x-stream-status

Conversation

@Smidge
Copy link
Copy Markdown

@Smidge Smidge commented Mar 30, 2026

No description provided.

Smidge added 3 commits March 27, 2026 13:56
Emit STARTED status when beginning to read each stream and COMPLETE/INCOMPLETE
terminal status when finishing. This is required by Airbyte protocol v0.2.0+
and fixes the error: "streams did not receive a terminal stream status message"

Also update Dockerfile to use standard golang/alpine base images instead of
pscale.dev private images.
Airbyte 2.x rejects LEGACY state messages with:
  IllegalArgumentException: LEGACY states are deprecated

This changes the connector to emit one STATE message per stream with
type=STREAM and a stream_descriptor, instead of a single global state
blob. Each stream's shard cursors are emitted individually after the
stream finishes processing.
Logger tests (cmd/internal/logger_test.go):
- StreamState emits correct per-stream format with type=STREAM
- StreamState handles multiple shards
- No LEGACY "data" field present in state output
- StreamStatus emits TRACE messages with correct status values
- JSON round-trip produces exact Airbyte protocol v2 structure
- Multiple stream states are independent

Read protocol tests (cmd/airbyte-source/read_protocol_test.go):
- Read emits per-stream STATE (not LEGACY global state)
- STARTED and COMPLETE emitted for each stream
- State descriptors have correct stream name and namespace
- Message ordering: STARTED → STATE → COMPLETE
- Multi-shard state contains all shard cursors
- Read errors emit INCOMPLETE (not COMPLETE) and skip state emission
@Smidge Smidge closed this Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant